package cn.yikaojiuguo.student.ui.ask;

import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;

import butterknife.Bind;
import butterknife.ButterKnife;
import cn.yikaojiuguo.student.R;
import cn.yikaojiuguo.student.ui.base.BaseFragment;

/**
 * Created by cfan_yang on 2015/12/18.
 */
public class AskFragment extends BaseFragment implements View.OnClickListener{

    private View mRoot;
    @Bind(R.id.ib_ask)
    ImageButton mIb_ask;
    private AskPopupWindow mPopupWindow;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
            savedInstanceState) {
        initView();
        initEvents();
        return mRoot;
    }

    private void initEvents() {
        mIb_ask.setOnClickListener(this);
    }

    private void initView() {
        mRoot = View.inflate(getContext(), R.layout.fragment_ask, null);
        ButterKnife.bind(this,mRoot);
        mPopupWindow = new AskPopupWindow(getActivity(),0.9f,0f);
        mPopupWindow.setAnimationStyle(R.style.anim_popup_from_bottom);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.ib_ask:
                mPopupWindow.showAtLocation(null, Gravity.BOTTOM,0,0);
                break;
        }
    }
}
